package 内置observer;import java.util.ArrayList;import java.util.Observable;/** * Created by Administrator on 2018-10-18. */public class WeatherData extends Observable {    private float temperature;//温度    private float humidity;//湿度    private float pressure;//气压    public WeatherData(){    }    public void  measurementsChanged(){        setChanged();        notifyObservers();//如果是"拉"就不需要 notifyObservers();方法    }    public void  setMeasurements(float temperature ,float humidity,float pressure){       this.temperature =temperature;       this.humidity = humidity;       this.pressure = pressure;       measurementsChanged();    }    public  float getTemperature(){ //如果是"拉"就 需要        return  temperature;    }    public  float getHumidity(){  //如果是"拉"就 需要        return  humidity;    }    public float getPressure(){   //如果是"拉"就 需要        return  getPressure();    }}